package com.acwing.partition9;

import java.io.*;

/**
 * @author `RKC`
 * @date 2021/12/4 9:44
 */
public class AC866试除法判定质数 {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] s = reader.readLine().split(" ");
        int n = Integer.parseInt(s[0]);
        while (n-- > 0) {
            int x = Integer.parseInt(reader.readLine().split(" ")[0]);
            writer.write(isPrime(x) ? "Yes\n" : "No\n");
        }
        writer.flush();
    }

    private static boolean isPrime(int x) {
        if (x < 2) return false;
        for (int i = 2; i <= x / i; i++) {
            if (x % i == 0) return false;
        }
        return true;
    }
}
